import { _decorator, Component, Label, Node, Sprite } from 'cc';
import { Soldier } from '../entity/Soldier';
const { ccclass, property } = _decorator;

@ccclass('SoldierItem')
export class SoldierItem extends Component {
    @property(Sprite)
    private cover:Sprite
    @property(Label)
    private soldierName:Label
    @property(Label)
    private count:Label

    start() {

    }

    async setData(solder:Soldier){
        this.soldierName.string = solder.name
        this.count.string = solder.count + ''
        this.cover.spriteFrame = await solder.getHeadImg()
        
        if(solder.count == 0){
            debugger
            this.node.active = false
        }
    }
}


